import Vue from 'vue'
import Router from 'vue-router'
//import HelloWorld from '@/components/HelloWorld'

Vue.use(Router)

let routes = [{
    path: '/',
    name: '登录',
    component: () => import('@/components/login'),
  },
  {
    path: '/index',
    name: '首页',
    //component: HelloWorld 
    //异步加载组件
    component: resolve => require(['@/components/index'], resolve),
    //component: () => import('@/components/index'),
    //访问子路径时，有2种path处理，1： path: '/welcome',路径：http://localhost:8080/#/welcome
    //2:path: 'welcome',路径：http://localhost:8080/#/index/welcome
    children: [{
      path: 'welcome',
      name: '欢迎',
      component: () => import('@/components/center/welcome'),
    }],
  }
];
let router = new Router({
  routes
});
export default router
